﻿@{
    Layout = null;
}

@model System.Collections.IEnumerable
<!DOCTYPE html>
@Html.Partial("LoadPanelPartial")

<html>
<head>
    <title>Index</title>
      @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

    )
    @Html.DevExpress().GetScripts(
                    new Script { ExtensionType = ExtensionType.ListBox }
    )
<script>
    function OnBeginCallback(s, e) {
        e.customArgs["command"] = e.command;
        e.customArgs["pageIndex"] = s.pageIndex;
        e.customArgs["pageCount"] = s.pageCount;
        e.customArgs["pageRowSize"] = s.pageRowSize;
        e.customArgs["pageRowCount"] = s.pageRowCount;

        e.customArgs["FYear"] = $('#hidFYear').val();
        e.customArgs["FPeriod"] = $('#hidFPeriod').val();

    }

    function search() {
        $("#hidFYear").val(FYear.GetText());
        if (!isNaN(FPeriod.GetText())) {
            $("#hidFPeriod").val(FPeriod.GetText());
        }
        else {
            alert("请输入正确编号！");
            return;
        }
        gvEditing.Refresh();
    }

    function codeOK(hidperiod, hidyear) {
        if (!isNaN(hidyear)) {
            $("#hidFYear").val(hidyear);
        }
        if (!isNaN(hidperiod)) {
            $("#hidFPeriod").val(hidperiod);
        }
        codeModalMode.Hide();
        gvEditing.Refresh();
    }

    function codeCancel() {
        codeModalMode.Hide();
    }

    function MenuTop_emClick(source, e) {
        switch (e.item.name) {
            case "btnAdd":
                {
                    ASPxClientPopupControl.Cast("codeModalMode").SetHeaderText("国税数据导入");
                    ASPxClientPopupControl.Cast("codeModalMode").SetWidth("800");
                    ASPxClientPopupControl.Cast("codeModalMode").SetHeight("400");
                    $("#popContent").attr("src", rootPath + "/GSImportDate/GSImportDateEdit");
                    codeModalMode.Show();
                    break;
                }
            case "btnDelete":
                {
                    ASPxClientPopupControl.Cast("codeModalMode").SetHeaderText("国税数据删除");
                    ASPxClientPopupControl.Cast("codeModalMode").SetWidth("400");
                    ASPxClientPopupControl.Cast("codeModalMode").SetHeight("100");
                    $("#popContent").attr("src", rootPath + "/GSImportDate/GSImportDateDelEdit");
                    codeModalMode.Show();
                    break;
                }
        }
    }
</script>
</head>
<body>
    <div>
        @Html.DevExpress().Menu(settings => 
        {
            settings.Name = "toolBarMenu";
            settings.ItemAutoWidth = false;
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
            settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

            settings.Items.Add(item =>
            {
                item.Name = "btnAdd";
                item.Text = "国税数据导入";
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");
            });
            settings.Items.Add(item =>
            {
                item.Name = "btnDelete";
                item.Text = "删除数据";
                //item.ItemStyle.ForeColor = System.Drawing.Color.Red;
                item.ClientEnabled = true;
                item.Image.Url = Url.Content("~/Content/ControlImages/cancel.png");
            });
            
            settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
            settings.ItemLinkMode = ItemLinkMode.ContentBounds;
        }).GetHtml()
    </div>

    <table align="center">
  <tr>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "年份:"; }).GetHtml()</td>
           <td class="tdClass">
                 @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FYear";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.MaskSettings.Mask = "yyyy";
                   settings.Text = DateTime.Now.Year.ToString();
               }).GetHtml()
              
           </td>
           <td font-size="14pt" class="tdClass" align="right">@Html.DevExpress().Label(settings => { settings.Text = "编号:"; }).GetHtml()</td>
           <td class="tdClass">
                     @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FPeriod";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   
               }).GetHtml()
              
           </td>
           <td class="tdClass" align="left">
           @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnSearch";
                settings.Text = "查询";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
                settings.ClientSideEvents.Click = "search";
            }).GetHtml()
           </td>         
        </tr>
    </table>

     @Html.Partial("GSImportDateListPartial", Model)
              @Html.DevExpress().PopupControl(
    settings =>
    {
        settings.Name = "codeModalMode";
        settings.Width = 800;
        settings.Height = 800;
        settings.AllowDragging = true;
        settings.CloseAction = CloseAction.CloseButton;
        settings.EnableAnimation = false;
        settings.HeaderText = "";
        settings.Modal = true;
        settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
        settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
        settings.ShowFooter = true;
        settings.SetFooterTemplateContent(s =>
        {
            ViewContext.Writer.Write("<table align='center'><tr><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnOK";
                footBtnSettings.Text = "确定";
                footBtnSettings.ClientSideEvents.Click = "function(s,e){popContent.OK()}";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnCancel";
                footBtnSettings.Text = "取消";
                footBtnSettings.ClientSideEvents.Click = "codeCancel";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td></tr></table>");

        });
        settings.SetContent(() =>
       {
           ViewContext.Writer.Write("<iframe  id='popContent' name='popContent' style='width:100%;height:400px; vertical-align: middle' frameborder='0' ></iframe>");
       });
    }).GetHtml()
        @Html.Hidden("hidFYear", ViewData["FYear"])
        @Html.Hidden("hidFPeriod", ViewData["FPeriod"])

</body>
</html>
